package everyday;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: Siantar
 * @Date: 2023-06-13-15:31
 * @Description: 1.0
 */
public class T2475 {
    public int unequalTriplets(int[] nums) {
        Map<Integer,Integer> count=new HashMap<>();
        for(int num:nums){
            count.merge(num,1,Integer::sum);
        }
        int res=0,t=0,n=nums.length;
        for(Map.Entry<Integer,Integer> entry:count.entrySet()){
            res+=t*entry.getValue()*(n-t-entry.getValue());
            t+=entry.getValue();
        }
        return res;
    }
}
